<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/modules/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-add.php");
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="../css/<? echo $theme_folder ?>/user.css" rel="stylesheet" type="text/css"/>
    <?php include ROOT_PATH_.'/controller/common/modules/head.php'; ?>
    <?php include 'modules/head.php'; ?>


</head>


<body>

<div id="topbar">
    <?php include ROOT_PATH_.'/controller/common/modules/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/modules/sidebar.php'; ?>
        </div>





        <div id="content">




<div class="box member-add-box layui-form detail-box ">
<h1>优惠券添加</h1>

    <div class="tips">
        1:激活优惠券，是根据类型去触发激活的。领券中心领取同时已经是激活状态
    <br/>2:用户的优惠券会以用户领取时候状态为准。例：优惠券设置了1000元，客户领取后，管理员再把优惠券设置成10元，客户的优惠券依然是1000元。
    </div>


    <form id="add-employee-form" method="post" action="detail-add-function.php?nav-itemed=coupon" enctype="multipart/form-data" class="layui-form">


<!--    --><?php //include 'mod-images-upload.php'; ?>

    <div class="layui-form-item">
        <label class="layui-form-label">优惠券名称</label>
        <div class="layui-input-block">
            <input type="text" name="ai_name" lay-verify="required" placeholder="请输入优惠券名称" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">优惠类型</label>
        <div class="layui-input-block">
            <input type="radio" name="ai_coupon_type" value="10" title="定额" checked>
            <input type="radio" name="ai_coupon_type" value="20" title="分享折扣" >
            <input type="radio" name="ai_coupon_type" value="30" title="邀请折扣" >
            <input type="radio" name="ai_coupon_type" value="40" title="指定金额" >

            <div class="notice">分享折扣券：分享首页时候激活；邀请折扣券：邀请好友参与时候激活；指定金额：设置指定价格可以购买活动</div>
        </div>


    </div>


    <div class="layui-form-item coupon1">
        <label class="layui-form-label">优惠价格</label>
        <div class="layui-input-block">
            <input type="text" name="ai_reduce_price"  placeholder="请输入优惠价格" autocomplete="off" class="layui-input" value="0.00">
            <div class="notice">优惠多少元，就填写多少。例:减小9元，就填写9。</div>

        </div>
    </div>
    <div class="layui-form-item coupon2" style="display:none;">
        <label class="layui-form-label">优惠折扣</label>
        <div class="layui-input-block">
            <input type="text" name="ai_discount"  placeholder="请输入优惠折扣0-100" autocomplete="off" class="layui-input" value="100">
            <div class="notice"> 优惠折扣0-100,  5折请输入50,9折请输入90</div>
        </div>
    </div>

    <div class="layui-form-item coupon4" style="display:none;">
        <label class="layui-form-label">指定金额</label>
        <div class="layui-input-block">
            <input type="text" name="ai_reduce_price"  placeholder="请输入指定金额" autocomplete="off" class="layui-input" value="10">
<!--            <div class="notice"> 指定金额,  5折请输入50,9折请输入90</div>-->
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">免单券</label>
        <div class="layui-input-block">
            <input type="radio" name="ai_is_free" value="0" title="否" checked>
            <input type="radio" name="ai_is_free" value="1" title="是" >
        </div>
    </div>


        <div class="layui-form-item">
            <label class="layui-form-label">说明</label>
            <div class="layui-input-block">
                <input type="text" name="ai_remark" lay-verify="required" placeholder="请输入优惠券使用说明" autocomplete="off" class="layui-input" value="<?php echo $info['remark'];?>">
            </div>
        </div>

   <!--     <div class="layui-form-item">
            <label class="layui-form-label">活动开始</label>
            <div class="layui-input-block">

                <input type="text" name="ai_start_time" id="date" autocomplete="off" class="layui-input"
                       value="<?/*echo date("Y-m-d h:i:s")*/?>"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                       class="laydate-icon">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">活动结束</label>
            <div class="layui-input-block">

                <input type="text" name="ai_end_time" id="date" autocomplete="off" class="layui-input"
                       value="<?/*echo date("Y-m-d h:i:s",strtotime('3 day'))*/?>"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                       class="laydate-icon">
            </div>
        </div>
-->


        <div class="layui-form-item">
            <label class="layui-form-label">截止日期</label>
            <div class="layui-input-block">

                <input type="text" name="ai_end_time" id="date" autocomplete="off" class="layui-input"
                       value="<?echo date("Y-m-d h:i:s",strtotime('3 day'))?>"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                       class="laydate-icon">
                <div class="notice">填写了截止日期，则以这个为准，【有效天数】将不会生效。</div>
            </div>
        </div>



        <div class="layui-form-item">
            <label class="layui-form-label">优惠券有效天数</label>
            <div class="layui-input-block">
                <input  class="layui-input" type="input" name="ai_expire_day"   value="0"  >
                <div class="notice"> 有效天数按照激活优惠券的时间开始计算。例：假设有效天数是7，A在一月一日注册拿到一张5折券，在6月一日再激活，这个有效时间就是6月1日+7天.</div>

            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">适用活动类型</label>
            <div class="layui-input-block">
                <?php foreach($tag_list as $tag){
                    ?>
                    <input type="checkbox" name="ai_pinlei[]" value="<?php echo $tag?>" title="<?php echo $tag?>">
                    <?php
                }
                ?>

            </div>
        </div>




        <div class="function">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit   type="submit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>


</form>
</div>



<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>



<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;



        form.on('radio()', function(data){
           // console.log(data.elem); //得到radio原始DOM对象
           // console.log(data.value); //被点击的radio的value值
            if(data.value == 10){
                $('.coupon1').show()
                $('.coupon2').hide()
                $('.coupon4').hide()
            }
            else if(data.value == 20 || data.value == 30) {
                $('.coupon2').show()
                $('.coupon1').hide()
                $('.coupon4').hide()
            }else if(data.value == 40){
                $('.coupon4').show()
                $('.coupon2').hide()
                $('.coupon1').hide()
            }
        });

    });
</script>





<?php include ROOT_PATH_ . "/controller/common/modules/footer.php"; ?> </body>
</html>

